//
//  SettingViewCell.m
//  BaseAPP
//
//  Created by Evisu on 16/12/17.
//  Copyright © 2016年 evisum. All rights reserved.
//

#import "SettingViewCell.h"

@interface SettingViewCell ()

@property (nonatomic, strong)UIImageView *ivArrow;

@property (nonatomic, strong)UIImageView *ivLock;

@property (nonatomic, strong)UILabel *labLock;

@end

@implementation SettingViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self initViews];
        [self layoutViews];
    }
    
    return self;
}

- (void)initViews {

    self.labTitle = [[UILabel alloc] init];
    self.labTitle.font = [UIFont systemFontOfSize:16.0];
    self.labTitle.textColor = HEXColor(@"000000");
    
    self.ivArrow = [[UIImageView alloc] init];
    self.ivArrow.image = [UIImage imageNamed:@"arrow_ico"];
    
    self.ivLock = [[UIImageView alloc] init];
    self.ivLock.image = [UIImage imageNamed:@"ProfileLockOn"];
    
    self.labLock = [[UILabel alloc] init];
    self.labLock.text = @"已保护";
    self.labLock.font = [UIFont systemFontOfSize:12.0];
    self.labLock.textColor = HEXColor(@"c0c0c0");
    
    [self.contentView addSubview:self.labTitle];
    [self.contentView addSubview:self.ivArrow];
    [self.contentView addSubview:self.ivLock];
    [self.contentView addSubview:self.labLock];
}


- (void)layoutViews {

    self.labTitle.sd_layout
    .centerYEqualToView(self.contentView)
    .leftSpaceToView(self.contentView, 16)
    .heightIs(15);
    [self.labTitle setSingleLineAutoResizeWithMaxWidth:210];
    
    self.ivArrow.sd_layout
    .centerYEqualToView(self.contentView)
    .rightSpaceToView(self.contentView, 16)
    .widthIs(8)
    .heightIs(15);
    
    self.ivLock.sd_layout
    .centerYEqualToView(self.contentView)
    .rightSpaceToView(self.contentView, 74)
    .widthIs(16)
    .heightIs(16);
    
    self.labLock.sd_layout
    .centerYEqualToView(self.contentView)
    .rightSpaceToView(self.contentView, 34)
    .heightIs(15);
    [self.labLock setSingleLineAutoResizeWithMaxWidth:50];
}

- (void)showLock {

    self.ivLock.hidden = NO;
    self.labLock.hidden = NO;
}

- (void)hideLock {

    self.ivLock.hidden = YES;
    self.labLock.hidden = YES;
}

@end
